package com.dstz.bpm.engine.listener;

import com.dstz.bpm.act.listener.ActEventListener;
import com.dstz.bpm.api.constant.EventType;
import com.dstz.bpm.api.constant.ScriptType;
import com.dstz.bpm.api.engine.action.cmd.TaskActionCmd;
import com.dstz.bpm.api.engine.plugin.cmd.TaskCommand;
import javax.annotation.Resource;
import org.activiti.engine.delegate.event.ActivitiEntityEvent;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractTaskListener<T extends TaskActionCmd> implements ActEventListener {
   protected Logger LOG = LoggerFactory.getLogger(this.getClass());
   @Resource
   protected TaskCommand aK;

   public abstract EventType getBeforeTriggerEventType();

   public abstract EventType getAfterTriggerEventType();


   public abstract void a(T var1);

   public abstract void b(T var1);

   public abstract void c(T var1);

   public void notify(ActivitiEvent event) {
      ActivitiEntityEvent entityEvent = (ActivitiEntityEvent)event;
      TaskEntity taskEntity = (TaskEntity)entityEvent.getEntity();
      T model = this.a(taskEntity);
      this.a(model);
      if (this.getBeforeTriggerEventType() != null) {
         this.aK.execute(this.getBeforeTriggerEventType(), model);
      }

      this.b(model);
      if (this.getAfterTriggerEventType() != null) {
         this.aK.execute(this.getAfterTriggerEventType(), model);
      }

      this.c(model);
   }

   protected abstract ScriptType getScriptType();

   public abstract T a(TaskEntity var1);
}
